﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SAKS.IServices;
using SAKS.Models;
using NHibernate;
using NHibernate.Linq;

namespace SAKS.Services
{
    public class DocumentServices : DocServicesBase<DocumentInfo, DocFile> ,IDocumentServices
    {
        public IEnumerable<DocumentInfo> GetProDocInfoList(Guid projectId, int start, int pageSize, out int? totalRecords)
        {
            var query = new Query.PagedProDocInfoSearch(Session) { ProjectId = projectId, First = start, PageSize = pageSize };
            var result = query.Execute();
            totalRecords = result.TotalItems;
            return result.PageOfResults;
        }

        public IEnumerable<DocumentInfo> GetAchiDocInfoList(Guid achiId, int start, int pageSize, out int? totalRecords)
        {
            var query = new Query.PagedAchiDocInfoSearch(Session) { AchievementId = achiId, First = start, PageSize = pageSize };
            var result = query.Execute();
            totalRecords = result.TotalItems;
            return result.PageOfResults;
        }
    }
}
